//
//  LatestContactInfoRequest.m
//  BaseProject
//
//  Created by 王洋 on 2021/4/14.
//  Copyright © 2021 王洋. All rights reserved.
//

#import "LatestContactInfoRequest.h"

@implementation LatestContactInfoRequest

+ (void)request_latestContactInfoComption:(void (^)(BOOL success, LatestUserInfoModel *model))comption {

    NSMutableDictionary *dic = @{}.mutableCopy;
    [dic setValue:[TTUserModel sharedObject].userId forKey:@"userId"];
    NSString *url = [NSString stringWithFormat:@"%@%@",TT_Global_Api_Domain,@"/secondaryQueryController/findUserInfoAndSellerInfo"];

    [TTHttpManager postRequestWithUrl:url TimeOut:10 PostData:dic FinishBlock:^(id  _Nonnull data) {
        if ([data isKindOfClass:[NSDictionary class]]) {
            //请求成功
            NSInteger code = [[data valueForKey:@"code"] integerValue];
            if (code == 10000) {

                NSDictionary *resultDic = [data valueForKey:@"data"];
                LatestUserInfoModel *model = [LatestUserInfoModel modelWithDictionary:resultDic];
                comption(YES,model);
            } else {
                [SVProgressHUD showErrorWithStatus:[data valueForKey:@"message"]];
                [SVProgressHUD dismissWithDelay:1];
                comption(NO,[LatestUserInfoModel new]);
            }
        }
    } FailedBlock:^(NSError * _Nonnull error) {
        comption(NO,[LatestUserInfoModel new]);
    }];
    
}
@end
